package com.spring.framework.config.life;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

/**
 * 短生命周期的 bean
 * <p>
 * 可以看到，虽然我们注入的bean是原型的，看是看起来并没有被成功控制，因为每次都是同一个原型bean对象，我们在@Scope注解中加上
 * proxyMode = ScopedProxyMode.TARGET_CLASS属性之后
 *
 * @author xuweizhi
 * @since 2020/12/15 10:03
 */
@Component
// @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS)
public class Prototype {

	public Prototype() {
		System.out.println("create Prototype");
	}

}
